package example.com.zcq.mymj.fragment;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.format.Time;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import com.jude.rollviewpager.RollPagerView;
import com.jude.rollviewpager.adapter.StaticPagerAdapter;
import com.jude.rollviewpager.hintview.ColorPointHintView;
import com.xuexiang.xupdate.XUpdate;
import com.xuexiang.xupdate.entity.UpdateEntity;
import com.xuexiang.xupdate.proxy.IUpdateParser;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import example.com.zcq.mymj.Adapter.LiShiAdapter;
import example.com.zcq.mymj.R;
import example.com.zcq.mymj.activity.ChengYuActivity;
import example.com.zcq.mymj.activity.XinHuaZiDianActivity;
import example.com.zcq.mymj.bean.LishiJinRi;
import example.com.zcq.mymj.net.HttpInterface;
import example.com.zcq.mymj.net.RetrofitHttp;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * @author zcq
 * @package example.com.zcq.mymj.fragment
 * @fileName MyMj
 * @description: 这个类的描述
 * @org 融信通达科技有限公司
 * @email @163.com
 * @date 2018/11/22  19:59
 */
public class Fragment5 extends Fragment  {



    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fg5, container, false);
        view.findViewById(R.id.auto_up).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                XUpdate.newBuild(getActivity())
                        .updateUrl("https://raw.githubusercontent.com/xuexiangjys/XUpdate/master/jsonapi/update_test.json")
                        .updateParser(new CustomUpdateParser())
                        .isAutoMode(true) //如果需要完全无人干预，自动更新，需要root权限【静默安装需要】
                        .update();
            }
        });


        return view;
    }

    public class CustomUpdateParser implements IUpdateParser {
        @Override
        public UpdateEntity parseJson(String json) throws Exception {

            return new UpdateEntity()
                    .setHasUpdate(true)
                    .setIsIgnorable(true)
                    .setVersionCode(10)
                    .setVersionName("apk")
                    .setUpdateContent("")
                    .setDownloadUrl("http://192.168.0.69:8080/test/com.iflytek.inputmethod_7903.apk")
                    .setSize(2014L);
        }
    }

}
